FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 51285
EXPOSE 44365

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["src/api/dreamwork.mobile.app.api/dreamwork.mobile.app.api.csproj", "src/api/dreamwork.mobile.app.api/"]
COPY ["src/buildingblocks/infrastucture/Jerry.Core/Jerry.Core.csproj", "src/buildingblocks/infrastucture/Jerry.Core/"]
RUN dotnet restore "src/api/dreamwork.mobile.app.api/dreamwork.mobile.app.api.csproj"
COPY . .
WORKDIR "/src/src/api/dreamwork.mobile.app.api"
RUN dotnet build "dreamwork.mobile.app.api.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "dreamwork.mobile.app.api.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "dreamwork.mobile.app.api.dll"]